The present invention relates to encoders.
To simplify the following discussion, the present invention will be explained in terms of a shaft encoder. A shaft encoder outputs a digital signal that indicates the position of the shaft relative to some known reference position. An absolute shaft encoder typically utilizes a plurality of tracks on a disk that is connected to the shaft. Each track consists of a series of dark and light stripes that are viewed by a detector that outputs a value of digital 1 or 0, depending on whether the area viewed by the detector is light or dark. An N-bit binary encoder typically utilizes N such tracks, one per bit.
If N is large, alignment of the various components presents significant problems. In addition to the problems associated with aligning the tracks, the photodetectors must also be aligned with one another. The need to provide precise alignment of the components significantly increases the cost of the encoder when N is large.
Incremental encoders, in contrast, are relatively inexpensive. An N-bit incremental encoder may be viewed as the track corresponding to the least significant bit in an N-bit absolute encoder. That is, the track consists of 2N regions that alternate between dark and light. The encoder determines absolute distance by incrementing or decrementing a counter each time the photodetector associated with the track changes its output depending on the direction of travel of the encoding track relative to the photodetector. The direction of travel of the encoding track is sensed by a utilizing two photodetectors that are shifted with respect to one another. Since the incremental encoder does not have a large number of tracks to align, the alignment costs discussed above are avoided. As long as the device does not miss a count, the counter value is a measure of the position relative to the point on the encoding wheel at which the count was 0. Unfortunately, a loss of power results in a loss of the count, and hence, the position becomes unknown. In addition, errors from a missed count or detector noise can also introduce errors into the position measurement.
The present invention includes an encoder that includes a sensing device that senses encoding marks on a sensing surface that also includes one or more reference marks. The sensing device generates first and second encoder signals when the encoding marks pass the sensing device. The second encoder signal leads or lags the first encoder signal depending on the direction of the movement of the sensing surface with respect to the sensing device. The encoder includes a register for storing a digital value indicative of the position of the encoding surface relative to the sensing device. A controller receives the first and second encoder signals and increments or decrements the digital register based on the received first and second encoder signal. The encoder also includes a reference mark detector that generates a first reference mark signal when the first reference mark passes the reference mark detector. The controller resets the digital value to a first reference value when the encoder receives the first reference mark signal. In one embodiment of the invention, the encoder also includes a non-volatile memory for storing a register value and a power detection circuit for determining if the potential on a power supply line is decreasing and increasing. In this embodiment, the controller causes the digital value in the register to be stored in the non-volatile memory when the power detection circuit determines that the potential on a power supply line is decreasing. When the power detection circuit determines that the potential of the power supply line is rising, the controller causes the value stored in the non-volatile memory to be stored in the register.